var data = [
    { "ID": "Plan01", "PlanWork": "2020年9月21日办公设备采购合同", "department": "生产部", "Creater": "张丹娜", "CreateDate": "2021-09-09", "planDate": "2021-09-09" },
    { "ID": "Plan02", "PlanWork": "2020年9月21日办公设备采购合同", "department": "生产部", "Creater": "尤丹阳", "CreateDate": "2021-09-09", "planDate": "2021-09-09" },
    { "ID": "Plan03", "PlanWork": "2020年9月21日办公设备采购合同", "department": "生产部", "Creater": "李霞", "CreateDate": "2021-09-09", "planDate": "2021-09-09" },
    { "ID": "Plan04", "PlanWork": "2020年9月21日办公设备采购合同", "department": "生产部", "Creater": "李心艾", "CreateDate": "2021-09-09", "planDate": "2021-09-09" },
    { "ID": "Plan05", "PlanWork": "2020年9月21日办公设备采购合同", "department": "生产部", "Creater": "艾欣", "CreateDate": "2021-09-09", "planDate": "2021-09-09" }
];

// 用户ID
let id = getUrlParam("id");
$(function () {
    GetUserRole();
});
//获取用户权限
function GetUserRole() {
    // let thisdata = [];
    // thisdata.push(InitRole(id));
    let USERdata = InitRole(id);
    if (USERdata != null) {
        InitData();
    }
     else OpenErrmsg("../../web/errhtml/404.html");
}


function InitData() {
    $('#dg_WorkPlanList').datagrid({
        data: data,
        onLoadSuccess: function (data) {
            $("#tb01").css("background-color", "white");
        }
    });
}
// 重置按钮
function ReInitDataWait() {
    $('#db_Start').datebox('setValue', GetDateStr(-7));
    $('#db_End').datebox('setValue', getCurrDate());
    InitData();
}
function chooseSearch() {
    var isok = $("#ck_search").is(':checked');
    if (isok) {
        $("#div_Search").show();
        $('#db_Start').datebox('setValue', GetDateStr(-7));
        $('#db_End').datebox('setValue', getCurrDate());
    }
    else {
        $("#div_Search").hide();
        $('#db_Start').datebox('setValue', "");
        $('#db_End').datebox('setValue', "");
    }
}
function formaterPlanWork(value, row) {
    let str = ' <label style="color:#589BD8">' + value + '</label><br />';
    return str;
}
function formaterIndex(value, row, index) {
    return '<a href="#" style="color:#589BD8;text-decoration:none;margin-top: 20px;">' + (parseInt(index) + 1) + '</a>';
}
function formaterop(value, row) {
    let val = '<a href="#" style="color:#589BD8;text-decoration:none;margin-top: 20px;padding:10px"  onclick="openmaxioWin()">详情</a>';
    val += '<a href="#" style="color:#589BD8;text-decoration:none;margin-top: 20px;padding:10px" onclick="openmaxioWin()" >编辑</a>';
    val += '<a href="#" style="color:#589BD8;text-decoration:none;margin-top: 20px;padding:10px" onclick="openmaxioWin()" >删除</a>';
    return val;
}
function openmaxioWin() {
    let windowObjectReference = window.open();
    windowObjectReference.location.href = "../WaitWork/_blank.html";
}



